<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>动画</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }

        .box1{
            width: 100px;
            height: 100px;
            background-color: tomato;
            animation: move 10s 2s steps(2) forwards;
        /*
            设置steps时，from第一下不算是一步
        */

        }

        @keyframes move {
            from {
                margin-left: 50px;
                background-color: #bfa;
            }

            to {
                margin-left: 500px;
                background-color: orange;
            }
        }

        .box2{
            height: 800px;
            width: 4px;
            position: absolute;
            left: 500px;
            background-color: red;
            top: 0;
        }

    </style>
</head>
<body>

<div class="box1"></div>

<div class="box2"></div>
</body>
</html>